package cn.marinda.totipotentwar.global;

import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

/**
 * 游戏移动事件
 *
 * @author hwj
 * @date 2022/02/12
 */
public class GameMoveEvent extends GameEvent implements Cancellable {
    private static final HandlerList handlers = new HandlerList();
    private boolean cancel;

    /**
     * 游戏移动事件
     *
     * @param player 球员
     */
    public GameMoveEvent(Player player){
        super(player);
    }

    @Override
    public HandlerList getHandlers() {
        return handlers;
    }

    /**
     * Gets the cancellation state of this event. A cancelled event will not
     * be executed in the server, but will still pass to other plugins
     *
     * @return true if this event is cancelled
     */
    @Override
    public boolean isCancelled() {
        return cancel;
    }

    /**
     * Sets the cancellation state of this event. A cancelled event will not
     * be executed in the server, but will still pass to other plugins.
     *
     * @param cancel true if you wish to cancel this event
     */
    @Override
    public void setCancelled(boolean cancel) {
        this.cancel = cancel;
    }


    public static HandlerList getHandlerList() {
        return handlers;
    }
}
